// @ts-nocheck
/**
 * @Date: 2022-04-08 13:57:19
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-04-11 16:36:49
 * @FilePath: \weibo-api\validator\validate.js
 * @Description: 统一校验函数
 */
const AJV = require("ajv");
const ajv = new AJV();

function validate(schema, data = {}) {
  const valid = ajv.validate(schema, data);
  if (!valid) {
    return ajv.errors[0];
  }
}
module.exports = validate;
